package com.ruoyi.exam.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.exam.domain.ExamQuestionAnswer;
import com.ruoyi.exam.vo.ExamQuestionAnswerVo;
import com.ruoyi.exam.mapper.ExamQuestionAnswerMapper;
import com.ruoyi.exam.service.IExamQuestionAnswerService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 题目答案Service业务层处理
 *
 * @author Tellsea
 * @date 2025-05-30
 */
@Service
public class ExamQuestionAnswerServiceImpl extends ServiceImpl<ExamQuestionAnswerMapper, ExamQuestionAnswer> implements IExamQuestionAnswerService {

    @Override
    public TableDataInfo<ExamQuestionAnswerVo> queryList(ExamQuestionAnswerVo entity) {
        return PageUtils.buildDataInfo(this.baseMapper.queryList(PageUtils.buildPage(), entity));
    }

    @Override
    public List<ExamQuestionAnswerVo> queryAll(ExamQuestionAnswerVo entity) {
        return this.baseMapper.queryList(entity);
    }

    @Override
    public ExamQuestionAnswerVo queryById(Long answerId) {
        return this.baseMapper.queryById(answerId);
    }

    @Override
    public boolean save(ExamQuestionAnswerVo entity) {
        return this.baseMapper.insert(entity) > 0;
    }
}
